Telegram Group & Telegram Channel
Дженерики крутые, можно написать любую дженерик функцию. Давайте напишем дженерик функцию сравнения двух объектов через Equal(T) bool (если есть) или ==.

Полчаса спустя…


type Equaler[T any] interface { Equal(T) bool }

func Equal[T comparable](expected, actual T) bool { ... }

func EqualEqualers[T any](e1 Equaler[T], e2 T) bool { ... }

func EqualSlices[T comparable](s1, s2 []T) bool { ... }

func EqualMaps[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool { ... }


И даже этого недостаточно для сравнения map[string]net.IP: net.IP – слайс, а слайсы не comparable.



tg-me.com/HowToGoWrong/102
Create:
Last Update:

Дженерики крутые, можно написать любую дженерик функцию. Давайте напишем дженерик функцию сравнения двух объектов через Equal(T) bool (если есть) или ==.

Полчаса спустя…


type Equaler[T any] interface { Equal(T) bool }

func Equal[T comparable](expected, actual T) bool { ... }

func EqualEqualers[T any](e1 Equaler[T], e2 T) bool { ... }

func EqualSlices[T comparable](s1, s2 []T) bool { ... }

func EqualMaps[M1, M2 ~map[K]V, K, V comparable](m1 M1, m2 M2) bool { ... }


И даже этого недостаточно для сравнения map[string]net.IP: net.IP – слайс, а слайсы не comparable.

BY How to Go wrong


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/HowToGoWrong/102

View MORE
Open in Telegram


How to Go wrong Telegram | DID YOU KNOW?

Date: |

Newly uncovered hack campaign in Telegram

The campaign, which security firm Check Point has named Rampant Kitten, comprises two main components, one for Windows and the other for Android. Rampant Kitten’s objective is to steal Telegram messages, passwords, and two-factor authentication codes sent by SMS and then also take screenshots and record sounds within earshot of an infected phone, the researchers said in a post published on Friday.

What is Telegram?

Telegram is a cloud-based instant messaging service that has been making rounds as a popular option for those who wish to keep their messages secure. Telegram boasts a collection of different features, but it’s best known for its ability to secure messages and media by encrypting them during transit; this prevents third-parties from snooping on messages easily. Let’s take a look at what Telegram can do and why you might want to use it.

How to Go wrong from us


Telegram How to Go wrong
FROM USA